package designmodel.strategy.收银策略练习.context;

import designmodel.strategy.收银策略练习.CashStrategy;

/**
 * The type Cash context.
 */
public class CashContext {

    /**
     * 持有的策略对象
     */
    private CashStrategy cashStrategy;

    /**
     * Instantiates a new Cash context.
     *
     * @param cashStrategy the cash strategy
     */
    public CashContext(CashStrategy cashStrategy) {
        this.cashStrategy = cashStrategy;
    }

    /**
     * Get result double.
     *
     * @return the double
     */
    public double getResult(double cash) {
        return this.cashStrategy.pay(cash);
    }
}
